package org.duiduo.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.duiduo.api.request.RoleRequest;
import org.duiduo.api.response.RespBean;
import org.duiduo.api.valid.ValidationGroups;
import org.duiduo.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangze
 */
@RestController
@RequestMapping("/role")
@Api(tags = {"角色相关"})
public class RoleController {

    @Autowired
    private IRoleService roleService;

    @ApiOperation(value = "添加角色信息")
    @PostMapping
    public RespBean addRole(@RequestBody @Validated(ValidationGroups.Insert.class) RoleRequest request) {
        return roleService.addRole(request);
    }

}
